<!--start include-->
<style type="text/css">
form>div{
float:left;
}

td,th{
padding:0 1em;
}
</style>
<form id="_volunteer" action="volunteerEdit" method="post">
  <input type="hidden" name="key" value="{{ v.volunteer.key }}">
  <div>
  <table>
    <tr>
      <th><label for="fname">First</label></th><td><input type="text" name="fname" id="fname" class="first" value="{{ v.volunteer.fname }}"></td>
    </tr>
    <tr>
      <th><label for="lname">Last</label></th><td> <input type="text" name="lname" id="lname" value="{{ v.volunteer.lname }}"></td>
    </tr>
    <tr>
      <th><label for="country">country</label></th><td> <input type="text" name="country" id="country" value="{{ v.volunteer.country }}"></td>
    </tr>
    <tr>
      <th><label for="partner">Partner</label></th>
      {% if v.partnerkey %}<input type="hidden" name="partner" value="{{ v.partnerkey }}"/>{% endif %}
      <td>

        <select id="partner" name="partner" {% if v.partnerkey %}disabled{% endif %}>
          {% for partner in v.partners %}
          <option value="{{ partner.key }}" {% ifequal v.volunteer.partner.key  partner.key %} selected{% endifequal %}{% ifequal v.partnerkey  partner.key %} selected{% endifequal %}> {{ partner.name }}</option>
          {% endfor %}
        </select>
      </td>
    <tr>
      <th><label for="DOB">DOB</label></th>
      <td>
	  <input type="text" size="4" pattern="[1-2][0-9][0-9][0-9]" placeholder="yyyy" name="year" value="{{ v.volunteer.DOB.year }}"/>-
	  <input type="text" size="2" pattern="[0-1]?[0-9]{1}" placeholder="mm" name="month" value="{{ v.volunteer.DOB.month }}"/>-
	  <input type="text" size="2" pattern="[0-3]?[0-9]{1}" placeholder="dd" name="day" value="{{ v.volunteer.DOB.day }}"/>
      </td>
    </tr>
    <tr>
      <th><label for="email">email</label></th>
      <td><input type="text" name="email" id="email" value="{{ v.volunteer.email }}"/></td>
    </tr>
  </table>
  </div>
  <div>
  <label for="address">Address</label><br/>
  <textarea id="address" name="address" rows="5" cols="30">{{ v.volunteer.address }}</textarea><br/>
  <label for="emergency">Emergency Contact</label><br/>
  <textarea id="emergency" name="emergency" rows="5" cols="30">{{ v.volunteer.emergency }}</textarea><br/>
  <label for="comment">Comment</label><br/>
  <textarea id="comment" name="comment" rows="5" cols="30">{{ v.volunteer.comment }}</textarea><br/>
  </div>
  <br style="clear:both;"/>
  <input type="submit" value="Save">
</form>


  {% if v.volunteer.key %}
<div id="assignments" style="float:none;width:100%;clear:both;">
  <h2>Assignments</h2>
  <a href="/assignmentForm?vkey={{ v.volunteer.key }}" accesskey="a">Add</a>
  <table>
    <thead>
      <tr>
        <th>Project-Site</th>
        <th>Start</th>
        <th>End</th>
        <th>Days</th>
        <th>Base</th>
        <th>$/week</th>
	<th># weeks</th>
	<th>Weeks Total $</th>
	<th>Discount</th>
	<th>Total</th>
	<th>Invoice Date</th>
        <th>Actions</th>
      </tr>
    </thead>
    <tbody>
      {% for assignment in v.assignments %}
      <tr>
        <td>{{ assignment.project.name }}-{{ assignment.site.name }}</td>
        <td>{{ assignment.start_date_str }}</td>
        <td>{{ assignment.end_date_str }}</td>
        <td>{{ assignment.duration.days }}</td>
        <td>{{ assignment.project.price }}</td>
	<td>{{ assignment.project.additionalWeekPrice }}</td>
	<td>{{ assignment.additional_weeks }}</td>
	<td>{{ assignment.additional_weeks_price }}</td>
        <td>{{ assignment.discount }}</td>
	<td>{{ assignment.total_price }}</td>
	<td>{{ assignment.invoiceDate.date }}</td>
        <td><a href='/assignmentForm?akey={{ assignment.key }}&vkey={{ v.volunteer.key }}'>Edit</a> | <a class="delete assignment" href='/assignmentDelete?akey={{ assignment.key }}&vkey={{ v.volunteer.key }}'>Delete</a></td>
      </tr>
      {% endfor %}
      <tr>
	<th colspan="7">Total</th><td>{{v.total_price}}</td>
      </tr>
    </tbody>
  </table>
</div>
{% endif %}
<!--end include-->
